/**
 * 
 */
package ltu.m7011e.shared.model;

import java.util.Date;

import ltu.m7011e.server.pojo.AuthorEntity;

import com.google.appengine.api.datastore.Key;
import com.google.gwt.user.client.rpc.IsSerializable;

/**
 * @author robinelmouahidine
 *
 */
public class Link implements IsSerializable {

	private Integer Id;

	private String theLink;
	private Author linkAuthor;
	private Integer likes;
	private String linkCat;
	private String description;
	private String postDate;

	/**
	 * Construct a new entity from parameter 
	 * @param theLink
	 * @param linkAuthor
	 * @param likes
	 * @param linkCat
	 * @param postDate
	 */
	public Link(String theLink, Author linkAuthor,
			String linkCat, String linkDescription) {
		this.theLink = theLink;
		this.linkAuthor = linkAuthor;
		this.likes = 0;
		this.linkCat = linkCat;
		this.description = linkDescription;
		this.postDate = new Date().toString();
		
	}
	
	/**
	 * Construct a new entity from parameter 
	 * @param Id 
	 * @param theLink
	 * @param linkAuthor
	 * @param likes
	 * @param linkCat
	 * @param postDate
	 */
	public Link(Integer Id, String theLink, Author linkAuthor,
			String linkCat, String linkDescription) {
		this.theLink = theLink;
		this.linkAuthor = linkAuthor;
		this.likes = 0;
		this.linkCat = linkCat;
		this.description = linkDescription;
		this.postDate = new Date().toString();
		
		
	}
	/**
	 * Default constructor
	 */
	public Link() {}

	public Link(Integer keyId,String theLink, Author author, String linkCat,
			String description, Integer likes, String postDate) {
		this.theLink = theLink;
		this.linkAuthor = author;
		this.likes = likes;
		this.linkCat = linkCat;
		this.description = description;
		this.postDate = postDate;
		this.Id = keyId;
		
		// TODO Auto-generated constructor stub
	}

	/**
	 * @return the id
	 */
	public Integer getId() {
		return Id;
	}
	/**
	 * @param id the id to set
	 */
	public void setId(Integer id) {
		Id = id;
	}

	
	/**
	 * @return the theLink
	 */
	public String getTheLink() {
		return theLink;
	}

	/**
	 * @return the linkAuthor
	 */
	public String getLinkAuthor() {
		return linkAuthor.getNickname();
	}

	/**
	 * @return the likes
	 */
	public Integer getLikes() {
		return likes;
	}

	/**
	 * @return the linkCat
	 */
	public String getLinkCat() {
		return linkCat;
	}
	
	
	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @return the postDate
	 */
	public String getPostDate() {
		return postDate;
	}
	

}
